//二级菜单导航栏
function select(i) {
	$('.hangder ul li').eq(i).addClass('active').siblings().removeClass('active');
	$('.hangder .content >div').eq(i).show().siblings().hide();
}
$('.lit').click(function() {
	$(".content").removeClass('height')
})
//var Id = 1630;
//课程分享
$.ajax({
	type: "post",
	url: Urls + "/api/Special/GetClassDetail",
	data: JSON.stringify({
		"ClassId": Id
	}),
	success: function(res) {
		var data = res.Data.SpecialClassInfo;
		var text_content = '<h3>' + data.ClassName + '</h3>' +
			'<p class="p_time">' + data.Author + '</p>' +
			'<p class="p_num">阅读数量&nbsp;<span>' + data.SeeNum + '</span></p>';
		'<div class="content_tails">' + data.Content + '</div>';
		$('.content .text_title').append(text_content);
		document.querySelector(".text_content").innerHTML = data.ClassDescription;
		$('.hangder h4').text(data.ClassSubTitle);
		$('.audio').find('img').attr('src', data.PhotoUrl);
		$('.video').find('video').attr('poster', data.PhotoUrl);

	}
});

//轮播图
$.ajax({
	type: "post",
	url: Urls + "/api/Special/GetClassList",
	data: JSON.stringify({
		"PageIndex": 1,
		"PageSize": 5,
		"MemberAccount": "",
		"SpecialId": 0,
		"ClassId": Id
	}),
	success: function(res) {
		var ClassList = res.Data.ClassList;
		for(var i = 0; i < ClassList.length; i++) {
			var sweime = '<div class="swiper-slide sweione">' +
				'<img src="' + ClassList[i].PhotoUrl + '" />' +
				'<p>' + ClassList[i].Title + '</p>' +
				'</div>';
			$('.swiper-wrapper').append(sweime);
		}
		//轮播图
		var mySwiper = new Swiper('.swiper-container', {
			slidesPerView: 2, //'auto'
			observer: true, //修改swiper自己或子元素时，自动初始化swiper
			observeParents: false, //修改swiper的父元素时，自动初始化swiper
			onTransitionEnd: function(swiper) {
				if(swiper.progress == 1) {
					swiper.activeIndex = swiper.slides.length - 1
				}
			}
		})
	}
});

//评论接口
$.ajax({
	type: "post",
	url: Urls + "/api/Cms/GetComment",
	data: JSON.stringify({
		"ObjectId": Id,
		"ParentId": "0",
		"Type": "OBJECT",
		"PageIndex": 1,
		"PageSize": 5,
		"MemberAccount": "",
		"CommentType": "CLASS"
	}),
	success: function(res) {
		console.log(res)
		var Data = res.Data;
		$('.comment_p span').text(res.TotalCount)
		for(var i = 0; i < Data.length; i++) {
			var Class_comment = '<li>' +
				'<div>' +
				'<div><img src="' + Data[i].Icon + '" /></div>' +
				'<div>' +
				'<p>' + Data[i].Name + '</p>' +
				'<p>' + Data[i].CommentDate + '</p>' +
				'</div>' +
				'<div>' +
				'<img src="img/2.png" />' +
				'<p>' + Data[i].PraiseTime + '</p>' +
				'</div>' +
				'</div>' +
				'<div>' +
				'<p>' + Data[i].Content + '</p>' +
				'</div>' +
				'</li>';
			$('.comments ul').append(Class_comment)
		}

	}
})